package com.googlecode.mylyn.core;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;
import java.util.Collection;

import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

/**
 * Test for {@link PriorityUtil#convertToMylyn(String)}.
 */
@RunWith(Parameterized.class)
public class ConvertToMylynTest {
    
    private final String priority;
    
    private final PriorityLevel expected;

    public ConvertToMylynTest(String priority, PriorityLevel expected) {
        this.priority = priority;
        this.expected = expected;
    }
    
    @Parameters
    public static Collection<Object[]> data() {
      return Arrays.asList(
          new Object[]{"Critical", PriorityLevel.P1},
          new Object[]{"High", PriorityLevel.P2},
          new Object[]{"Medium", PriorityLevel.P3},
          new Object[]{"Low", PriorityLevel.P4},
          new Object[]{"zork", null}
          );
    }
    
    @Test
    public void convertToMylyn() {
        assertEquals(LabelUtils.convertToMylyn(this.priority), this.expected);
    }

}
